class Solution
{
public:
    int findKOr(vector<int> &nums, int k)
    {
        vector<int> count(33, 0);
        for (int num : nums)
        {
            for (int i = 0; i < 32; ++i)
            {
                if (num & (1 << i))
                {
                    ++count[i];
                }
            }
        }

        int result = 0;
        for (int i = 0; i < 32; ++i)
        {
            if (count[i] >= k)
            {
                result |= 1 << i;
            }
        }
        return result;
    }
};